#ifndef WIDTIMELINE_H_
#define WIDTIMELINE_H_

#define SYVIEW_TIMELINE 2

#include "scHeader.h"
#include "FactoryView.h"
#include "WidSybilView.h"
#include "ui_widTimeline.h"

namespace sybilpm
{
class TransTimeline : public TransSybilView
{
	Q_DECLARE_TR_FUNCTIONS(TransTimeline)
public:
	virtual ~TransTimeline() {}
	virtual std::string getTechnicalName() const {return std::string("TableTimeline");}
	virtual QString getDisplayName() const {return tr("object history");}
	virtual QString getDescription() const {return tr("view and edit timeline of an identity");}
};

class WidTimeline : public WidSybilView
{
	Q_OBJECT
public:
	WidTimeline(QWidget * parent = 0);
	virtual ~WidTimeline();
	virtual int getViewId() const {return SYVIEW_TIMELINE;};
public slots:
	virtual void dataChangedSl(unsigned long transactionId);
	virtual void dataMarkSl();
	void mouseTableSl(const QModelIndex & index);

private:
	enum WtlState
	{
		WTL_INIT		=0,
		WTL_ENTITIES	=1,
		WTL_IKS			=2,
		WTL_DATA		=3
	};
	void setInfoText();
	WtlState state;
	Ui::WidTimeline ui;
	PkType entity, ik;
	bool blockSig;
private slots:
	void newDatasetSl();
	void correctSl();
	void identitiesChangedSl(int index);
	void iksChangedSl(int index);
};

namespace
{
WidSybilView * createTimeline(QWidget * parent) {return new WidTimeline(parent);}
TransSybilView * createTransTimeline() {return new TransTimeline();}
const bool inFactory(FactoryView::get()->addProduct(SYVIEW_TIMELINE, createTimeline, createTransTimeline));
}
} // namespace sybilpm

#endif /*WIDTIMELINE_H_*/
